Installing hardwire EVSE from existing NEMA 14-50?
It's pretty straightforward. 

Remove the wires from the old receptacle.  Your two hots are brown and yellow, and it doesn't matter which is which.  Usually that is color coded red/black or black/black, but brown/yellow is absolutely fine.   

The cover plate on that junction box is what you call a mud ring, meant to be behind drywall.  You don't need that, so you can get a blank cover plate for that box, they make domed covr plates if you want that. 

The old receptacle and mud ring go into storage.  A NEMA 14 is a nice modern safe receptacle, no reason to throw it out. 

You run either a whip or EMT conduit from the charger to the junction box through one of the knockouts. 

Then you splice the wires inside the junction box.  You may not need neutral; if not, just put a wire nut cap on it and tape it so it stays.  

Use the size of wire specified in the installation instructions, or larger.  

Change the circuit breaker to the size specified in the installation instructions.   If the instructions do not say, then look at the wires you used to connect, particularly if the wire whip came with the charger.   Otherwise breaker size is determined from the smallest conductor size (do not consider grounds or wiring that is entirely inside the charger proper):


6 AWG -- 50A or 60A breaker
8 AWG -- 40A breaker
10 AWG -- 30A breaker
12 AWG -- 20A breaker
14 AWG -- 15A breaker