To improve resource utilization and energy efficiency, cloud datacenters use VM consolidation to consolidate VMs to less number of physical machines through VM migration. However, improper VM placement may cause frequent VM migrations and constant on-off switch on physical machines (PMs), which results in decreasing service quality and increasing energy consumption. To address this problem, in this paper, we propose an effective and efficient VM consolidation approach called EQ-VMC with the goal to optimize energy efficiency and service quality. In our approach, a discrete differential evolution algorithm is developed to search the global optimum solution of VM placement. By integrating it with a set of algorithms we propose for effective host overloading detection, VM selection and under-loaded host detection, EQ-VMC effectively reduces energy consumption and improves quality of services (QoS). Extensive simulation demonstrates its effectiveness and shows its advantage compared with previous VM consolidation methods.