To clarify: MAME can already do something very much like this for some processors. The difference is we allow the execution flow of the code itself to point out what is code and what is data in ROMs, something which historically has been a major problem with static recompilation.
Because most CPUs don't have fixed-size instructions you can end up desynced with the real code by trying to just blindly compile (as in static recompilers), and it gets worse on CPUs where the same binary opcode has different meanings depending on the CPU's live state. I do know one successful use of something like static recompilation - some early GBA games used a special cross assembler which took 65816 opcodes as input and produced ARM instructions as output. But again, since you're working off the source rather than a bare binary, you avoid the problem of "accidentally" compiling data.