Yes, You can run SOQL query and return into a map. You can refer below code it will return a map of Account id vs Account map-
Map<id,Account> mapOfAccountIdVsAccount = new Map<Id,Account>([SELECT Id, Name FROM Account]);
system.debug(‘mapOfAccountIdVsAccount::’+mapOfAccountIdVsAccount);