Autonomy is increasingly demanded of industrial manipulators. Robots have to be capable of regulating their behavior to different operational conditions, without requiring high time/resource-consuming human intervention. Achieving an automated tuning of the control parameters of a manipulator is still a challenging task. This paper addresses the problem of automated tuning of the manipulator controller for trajectory tracking. A Bayesian optimization algorithm is proposed to tune firstly the low-level controller parameters (i.e., robot dynamics compensation), then the high-level controller parameters (i.e., the joint PID gains), providing a two-stage robot controller auto-tuning methodology. In both the optimization phases, the algorithm adapts the control parameters through a data-driven procedure, optimizing a user-defined trajectory tracking cost. Safety constraints ensuring, e.g., closed-loop stability and bounds on the maximum joint position errors, are also included. The performance of the proposed approach is demonstrated on a torque-controlled 7-degree-of-freedom FRANKA Emika robot manipulator. The 4 robot dynamics parameters (i.e., 4 link-mass parameters) are tuned in 40 iterations, while the robot control parameters (i.e., 21 PID gains) are tuned in 90 iterations. Comparable trajectory tracking-errors results with respect to the FRANKA Emika embedded position controller are achieved.