Okay, so this will only work on groups of small order.
$D_5$ has only four conjugacy classes: They are comprised, respectively, of 1) identity 2) two rotations 3) two other rotations 4) five reflections
This means $D_5$ has exactly four irreducible characters. Let their degrees be $d_1=1$, $d_2$, $d_3$, $d_4$. Assume $d_{i}\le d_{i+1}$.
Then $10 = |D_5|= 1^2 + d_2^2 + d_3^3 +d_4^2$.
The only possibility is $d_2=1$, $d_3=2$, $d_4=2$.
Let me add: If you want to apply this technique to $D_6$ and the octahedral group, note that $D_6$ has has order $12$ and $6$ conjugacy classes, and the octahedral group has order $24$ and $5$ conjugacy classes.