The VFD could save some energy if you can reduce the pressure to 20 PSI for the heat pump. The problem is that this pump is used for both the heat pump and domestic use. That means that anytime the heater or AC is being used, there is only 20 PSI for domestic use. You can get a PLC to control a VFD, then you can have it change the pressure delivered from 50 down to 20 when only the heat pump was being used. A demand switch on the domestic system could then cause the PLC to ramp up the VFD to 50 PSI when domestic water is needed. The domestic system would only see 20 PSI when any tap is first opened. Then the pressure will gradually increase to 50 PSI as needed. When there is no flow to the domestic system, the flow switch would cause the PLC to ramp down the VFD to 20 PSI. This will take a bit more sophisticated VFD / PLC / flow switch than the Mono Drive or the Sub Drive made by Franklin Electric. Which BTW the Mono drive uses a single phase motor, the Sub Drive uses a three phase motor. Both the Mono and Sub Drive now use a go/no go switch instead of a pressure transducer. The only adjustment is in the switch itself. A small screw in the switch is the only way to adjust the pressure. One might could use two switches, one set at 20 the other at 50 PSI, and use the PLC to switch from one switch to the other when needed. Now with 2 pressure switches, a PLC, a VFD, and a flow switch to coordinate, the system becomes complicated and therefore less dependable.
Also, according to Franklin Electric, the variable flow part of it's Mono and Sub Drive is made for intermittent use only. They recommend that any long term uses like irrigation and heat pumps, still be exactly matched to the design of the pump. One reason being that their new go/no go switch instead of a transducer causes the pump to ramp up and down as much as 45 times per minute instead of holding at a steady flow and pressure as a transducer would do. So any flow rate lower than the maximum will cause the pump to ramp up and down and the little switch to make and break about a million times every 21 days. Franklin says the little switch has been tested to well over a million cycles. Even if the switch is good for 3 million cycles, that is only 63 days worth of variable flow rates as the switch makes and breaks 45 times per minute. This ramping up and down 45 times per minute is also causing the down hole wire to wear out quickly as the motor torques 45 times per minute. I also know of a few dairy's that have had to remove these particular VFD's from service because of the stray voltage, to get their milk production back to normal. These VFD's are not lasting very long in the field and are very hard on the motor and wire. So you would have to save a LOT of energy to be able to afford replacing the VFD and motor on a regular basis compared to using a standard pump with a CSV that will use a little more power, but should last at least four times as long.
The pump you are using has a very steep curve and would actually be a good one for VFD control because it is way oversized for a 40' water level and 50 or 20 PSI. I still think you would be better off resizing the pump for the correct pumping level, using the CSV to vary the flow rate and eliminate the cycling, and stay with a simple, dependable, and long lasting system.