A process in which a protein is transported to or maintained in a location within the somatodendritic compartment.