Energy stored per unit volume = $(1/2) \times \text{stress} \times \text{strain}$. Since Young's modulus $Y = \text{stress}/\text{strain}$, we have strain = stress/Y. Substituting this gives Energy density = $(1/2) \times S \times (S/Y) = S^2/(2Y)$.