As the usage and development of wireless sensor networks are increasing, the problems related to these networks are being realized. Dynamic deployment is one of the main topics that directly affect the performance of the wireless sensor networks. In this paper, the artificial bee colony algorithm is applied to the dynamic deployment of stationary and mobile sensor networks to achieve better performance by trying to increase the coverage area of the network. A probabilistic detection model is considered to obtain more realistic results while computing the effectively covered area. Performance of the algorithm is compared with that of the particle swarm optimization algorithm, which is also a swarm based optimization technique and formerly used in wireless sensor network deployment. Results show artificial bee colony algorithm can be preferable in the dynamic deployment of wireless sensor networks.