— We present a probabilistic architecture for solving generically the problem of extracting the task constraints through a Programming by Demonstration (PbD) framework and for generalizing the acquired knowledge to various situations. In previous work, we proposed an approach based on Gaussian Mixture Regression (GMR) to find a controller for the robot reproducing the essential characteristics of a skill in joint space and in task space through Lagrange optimization. In this paper, we extend this approach to a more generic procedure handling simultaneously constraints in joint space and in task space by combining directly the probabilistic representation of the task constraints with a simple Jacobian-based inverse kinematics solution. Experiments with two 5-DOFs Katana robots are presented with manipulation tasks that consist of handling and displacing a set of objects.