A unifying approach to relaxation properties of chemical and colloidal gels