Newly installed heat pump works on AC all pressures are with in spec but shuts off on high pressure when you go to heat cycle. The pressure goes to 510 and kicks the high pressure switch.
With the limited information given I would check the air flow first as the most likely culprit. In heat your indoor coil becomes the condenser. Heat pumps are very sensitive to low air flow and will skyrocket the head pressure. This is especially true on newer high efficiency units. I recently reducted 2 systems where two 4 ton systems were replaced with 2, new 4 ton systems. My guess is the old systems were operating poorly with the low air flow but the new equipment couldn’t handle it at all and kept tripping breakers. Once I reducted the systems everything came into line. The owners had lived there for 20 years and said it had never worked so well. I am not sure what you mean be pressures are in spec in cooling. There are a lot of pressures and temperatures to consider, mostly subcooling. An over charged system can lead to high head pressure.