The average energy density of electric field is given by
uE=21ϵE02
Here, E0 is the maximum value of electric field.
The average energy density of magnetic field is given by
uB=2μB02
Here, B0 is the maximum value of magnetic field.
The speed of light is given by c2=μϵ1
Also, E0=cB0
So, uE=2c2μ1(cB0)2=2μB02=uB
As the energy density of electric field and magnetic field are equal, the energy associated for equal volume will also be equal.