Static recompilation is not possible, even for simpler CPUs like the 6502 (NES, Apple I, etc). There are parts of the program that you will never know until you actually run it. Forget about a complex x86-64 program.
Apart from that, the complexity of all the system calls made by the program is also a huge challenge as those not always have an equivalent in the new system and are really hard to match at such a low level. It is, however, not impossible. Emulators such as Dolphin do that, also combined with dynamic recompilation.
You'll eventually hit a roadblock. It's turtles all the way down. If you translate libraries your program depends on, then you'll hit the OS API. If you manage to translate the OS, you'll have to emulate all the hardware below it.
Technically it's not impossible, I guess someone could create something that translates all I/O operations into something that reads from the browser storage and renders to the screen, but the amount of work would be pretty insane. It's been done for smaller machines already, just look at any of the JavaScript based emulators like JSNES and so on.
NES emulator: Look up the ROM header format (iNES is still popular and common). That'll tell you how to find the entry point for the code. Find a document describing the memory map. That'll tell you where RAM, ROM, IO ports, etc go in the address space. Find an m6502 opcode reference. It'll also describe the registers and addressing modes in the CPU.
At that point, you've got enough to read the ROM into memory and start interpreting opcodes, even if you implement them one at a time as they come up. The CPU is just going to be reading and writing data to its registers and the memory map, so it's pretty straightforward.
Pretty quick, you'll run into a point where it expects some bit of external hardware results (usually reading from 0x2002 to query for the VBlank signal). That's the domain of the Picture Processing Unit. Start with simulating the VBlank flag, and go from there. The PPU is fun, and if you've gotten this far, you'll be in a good position to figure things out without a guide tutorial. There's a whole ton of documentation out there, and explanations about every aspect of the NES' hardware.
this is one flaw with forum style discussion formats
by the time anyone gets through reading the 31 page document, let alone follow along and run the code, the mob has moved on and you are left alone with questions and comments