Her election returns the governor’s office to Democrats after eight years of Republican leadership under the popular Gov. Charlie Baker, who opted not to seek reelection.