Assigning behavioral functions to neural structures has long been a central goal in neuroscience, and is a necessary first step toward a circuit-level understanding of how the brain generates behavior. Here we map the neural substrates of locomotion and social behaviors for Drosophila melanogaster using automated machine-vision and -learning techniques. From videos of 400,000 flies, we quantified the behavioral effects of activating 2,200 genetically targeted populations of neurons. We combined a novel quantification of anatomy with our behavioral analysis to create brain-behavior correlation maps, which are shared as browsable webpages and interactive software. Based on these maps, we discovered regions of the brain causally related to sensory processing, locomotor control, courtship, aggression, and sleep. Our maps directly specify genetic tools to target these regions, which we used to identify a small population of neurons with a role in the control of walking.