Yes. Simple Harmonic Motion is governed by an equation which is equivalent to Hooke's Law.

Potential energy is the energy that is required to move a body back to what we call the 'reference' position. With regards to a spring, the reference position is the position where the spring is in mechanical equilibrium.

If we move the spring from the reference position, the stiffness of the spring produces a force which is proportional to the distance we move it from the reference position. If we hold it at a position from the reference position, then it had potential energy which tries to move it back to the reference position.

In a spring, this energy is stored as elastic potential energy. Which is the 2nd equation you gave for 'stored' energy.

E = mgh, is the equation for the gravitational potential energy. (The energy which comes about as the result of the force of gravity, which attempts to pull a body towards the reference position, which, in the case of gravity, is the centre of mass of the body)

[tex] E = \frac{\lambda x^2}{2l} is the equation for elastic potential energy.

There are many types of potential energy. Gravitational, elastic, nuclear, electrostatic. And they are each governed by their own equations.