So first, it’s assumed that the transition between matter and energy has evolved to be essentially lossless in the trek canon, and you just have to assume that’s true. This is handled with the “Matter-energy conversion matrix” which is a hand-wavey sci-fi invention like a “Heisenberg Compensator.” See https://memory-alpha.fandom.com/wiki/Matter-energy_conversion_matrix
Additionally, this process is bidirectional; waste on a starship is converted into energy and stored. This is done with the “bio-matter resequencer” and is referenced a few times, see:
So first, it’s assumed that the transition between matter and energy has evolved to be essentially lossless in the trek canon, and you just have to assume that’s true. This is handled with the “Matter-energy conversion matrix” which is a hand-wavey sci-fi invention like a “Heisenberg Compensator.” See https://memory-alpha.fandom.com/wiki/Matter-energy_conversion_matrix
Additionally, this process is bidirectional; waste on a starship is converted into energy and stored. This is done with the “bio-matter resequencer” and is referenced a few times, see: