If you visit Tendo hot spring street before going to Yama-dera, you can take trains from the Tendo Station to the Yama-dera Station. It takes about 50 minutes to get there. Fare is 320 yen. Please note that you need to get transfer at Uzenchitose Station.