Because mass and energy are the same thing: they are referred to as mass-energy.
This is why photons of a certain frequency (and thus a certain energy according to E=hf) can sometimes produce a pair of particles.
In essence, if you're conserving mass, you're conserving energy. But since mass can convert to energy matter itself isn't really conserved is it?
I hope this helped