Linking microstructure and macroscopic properties in colloidal gels and glasses