Interplay between collective behavior and spreading dynamics on complex networks