This isn't really much of an issue in space but becomes more so in Quanta to Quarks.
Energy and Mass are interchangable, that is, mass can be converted to kinetic energy, heat energy (as is the case in nuclear reactors) or various other forms of energy. Energy on the other hand can be converted to mass (eg when you go faster, or during particle collisions at very high speeds).
The ratio is:
E=mc2
That is Energy (in Joules) is equal to the mass (in kilograms) multiplied by the speed of light squared (in ms-1)
Eg 1kg of matter transformed into energy would yield:
9*1016 J of energy (however it isnt converted on such a large scale as 1kg except in stars).
As to the exact mechanics of how they interchange, it is far outside the realms of High School (and afaik undergraduate) Physics and I can't help you there.