Today, Whole-Body Control (WBC) has become the standard method for controlling robots with redundant degrees of freedom, such as humanoids or mobile manipulators. WBC enables the simultaneous execution of multiple tasks by formulating them as constraints or within the cost function of an instantaneous optimization problem. However, it requires a lot of expertise to model the optimization problem in such a way that the desired robot behavior is achieved. A human expert must analyze the task, derive appropriate task models, define constraints, and assign suitable priorities to the tasks. This process is commonly performed by hand, which is time-consuming and prone to errors. Moreover, the solutions developed are usually limited to certain situations. If the given task or the environment of the robot changes, these manually designed solutions may fail and the task specification must be adapted. In this thesis, we address these very problems to improve usability, adaptability, and generality of existing WBC approaches. First, we introduce a programming by demonstration (PbD) approach for whole-body controllers. The approach derives a part of the optimization problem, namely the task constraints and their associated priorities, from user demonstrations. The demonstrations are performed in varying conditions, which we refer to as contexts. Using the acquired data, we can derive probabilistic models that allow generalization of task constraints, and their associated priorities with respect to novel, previously unseen contexts. That is, the whole-body controller learns to adapt to unknown situations. The proposed method not only significantly reduces the effort required to design the optimization problem, but it also improves the performance of the robot in dynamic environments. As a second contribution we present different methods for black-box optimization of task priorities, which may increase the performance of the derived whole-body controller when deployed on the target robot. Third, we integrate these contributions in a modular Whole-Body Control framework named ARC-OPT, which allows us to automatically derive, adapt, and optimize whole-body behaviors, while preserving the positive features of classical WBC approaches.