Spring and pendulum oscillations are both examples of simple harmonic motion and they obey the same rules. It can be shown, such as in this demo, that their periods can be matched under the right conditions.