General relation between density of states and dwell times in mesoscopic systems