Derivation of Constraints from Machine Learning Models and Applications to Security and Privacy