Clustering in stable and unstable nuclei in sd- and pf-shell regions