Cooperation among unrelated individuals is frequently observed in social groups when their members combine efforts and resources to obtain a shared benefit that is unachievable by an individual alone. However, understanding why cooperation arises despite the natural tendency of individuals toward selfish behavior is still an open problem and represents one of the most fascinating challenges in evolutionary dynamics. Recently, the structural characterization of the networks in which social interactions take place has shed some light on the mechanisms by which cooperative behavior emerges and eventually overcomes the natural temptation to defect. In particular, it has been found that the heterogeneity in the number of social ties and the presence of tightly knit communities lead to a significant increase in cooperation as compared with the unstructured and homogeneous connection patterns considered in classical evolutionary dynamics. Here, we investigate the role of social-ties dynamics for the emergence of cooperation in a family of social dilemmas. Social interactions are in fact intrinsically dynamic, fluctuating, and intermittent over time, and they can be represented by time-varying networks. By considering two experimental data sets of human interactions with detailed time information, we show that the temporal dynamics of social ties has a dramatic impact on the evolution of cooperation: the dynamics of pairwise interactions favors selfish behavior.