The Graph Pencil Method: Mapping Subgraph Densities to Stochastic Block Models