Optical conductivity of two-dimensional transition-metal dichalcogenides