The EDGE–CALIFA survey: validating stellar dynamical mass models with CO kinematics