On quantum mechanics as a constrained deterministic dynamics